<template>
	<hm-news-card @goodsItemClick="onItemClick" :options="goods"></hm-news-card>
</template>

<script>
	export default {
		name: "goods-list-item",
		data() {
			return {
				// goods:{}

			};
		},
		props: ["goods"],
		watch: {},
		methods: {
			onItemClick(o) {
				let goods = this.goods
				// o  由goods card 中自定义事件触发的钩子传回的 规定了传回 id 可以是整个对象 child options
				uni.navigateTo({
					url: '/sub1/detail/detail',

					fail() {
						uni.showModal({
							showCancel: false,
							title: '详情数据初始化时发生错错了 请稍后再试！',
							success() {
								uni.reLaunch({
									url: '/pages/home/home'
								})
							}
						})
						console.log('err');
					},
					success(res) {
						res.eventChannel.emit('getGoodsItemInfo', goods)
					}
				})
			}
		}
	}
</script>

<style>

</style>
